#titlebar {
	display: block;
	position: fixed;
	top: 0;
	height: 24px; /* 32px - padding of 2*4px */
	width: calc(100% - 8px);
	background-color: transparent;
	padding: 4px;
	cursor: initial;
	user-select: none;
	z-index: 9999;
	color: #fff;
	-webkit-app-region: drag;
}
.maximized #titlebar {
	width: 100%;
}
#titlebar #drag-region {
	width: 100%;
	height: 100%;
	display: grid;
	grid-template-columns: auto 138px;
}
#window-title {
	grid-column: 1;
	display: flex;
	align-items: center;
	margin-left: 8px;
	overflow: hidden;
	font-family: "Segoe UI", sans-serif;
	font-size: 12px;
}
.maximized #window-title {
	margin-left: 12px;
}
#window-title span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.5;
	font-size: larger;
}
#window-controls {
	display: grid;
	grid-template-columns: repeat(3, 46px);
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
}
.maximized #window-controls {
	right: 8px;
}
#window-controls .button {
	-webkit-app-region: no-drag;
	grid-row: 1 / span 1;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
}
@media (-webkit-device-pixel-ratio: 1.5), (device-pixel-ratio: 1.5), (-webkit-device-pixel-ratio: 2), (device-pixel-ratio: 2), (-webkit-device-pixel-ratio: 3), (device-pixel-ratio: 3) {
	#window-controls .icon {
		width: 10px;
		height: 10px;
	}
}
#window-controls .button {
	user-select: none;
}
#window-controls .button:hover {
	background: rgba(128, 128, 128, 0.2);
}
#window-controls .button:active {
	background: rgba(128, 128, 128, 0.3);
}
#close-button:hover {
	background: #e81123 !important;
}
#close-button:active {
	background: #f1707a !important;
}
#close-button:active .icon {
	filter: invert(1);
}
@media (prefers-color-scheme: light) {
	.icon {
		filter: invert(1);
	}
}
#min-button {
	grid-column: 1;
}
#max-button,
#restore-button {
	grid-column: 2;
}
#close-button {
	grid-column: 3;
}
#restore-button {
	display: none !important;
}
.maximized #restore-button {
	display: flex !important;
}
.maximized #max-button {
	display: none;
}

html.darwin #titlebar {
	height: 28px !important;
}
html.darwin #window-controls {
	display: none !important;
}
html.darwin #window-title {
	justify-content: center !important;
	align-items: flex-start !important;
}
html.darwin #drag-region {
	grid-template-columns: none !important;
}
